﻿using HDS.Common.Helper;
using HDS.Model;
using System.Collections.Generic;

namespace HDS.SupplierApi.Core.Entity
{
    public class DistributorRate
    {
        /// <summary>
        /// 母酒店ID
        /// </summary>
        public int HotelId { get; set; }

        /// <summary>
        /// 母房型ID
        /// </summary>
        public int RoomId { get; set; }

        /// <summary>
        /// 英文房型名称
        /// </summary>
        public string RoomNameEn { get; set; }

        /// <summary>
        /// 中文房型名称
        /// </summary>
        public string RoomNameCn { get; set; }

        #region 餐标

        /// <summary>
        /// 标准餐食类型 MealType
        /// </summary>
        public MealType MealType
        {
            get
            {
                return this.SupplierRate.MealType;
            }
        }

        /// <summary>
        /// 餐食名称
        /// </summary>
        public string MealTypeDesc
        {
            get
            {
                return EnumsHelper.GetDescription<MealType>(this.MealType);
            }
        }

        /// <summary>
        /// 餐食份数
        /// </summary>
        public int MealCount
        {
            get
            {
                return this.SupplierRate.MealCount;
            }
        }

        /// <summary>
        /// 是否含早
        /// </summary>
        public bool HaveBreakfast
        {
            get
            {
                return MealType == MealType.Breakfast || MealType == MealType.BreakfastDinner || MealType == MealType.BreakfastLunch || MealType == MealType.BreakfastLunchDinner;
            }
        }

        /// <summary>
        /// 是否含午餐
        /// </summary>
        public bool HaveLunch
        {
            get
            {
                return MealType == MealType.Lunch || MealType == MealType.LunchDinner || MealType == MealType.BreakfastLunch || MealType == MealType.BreakfastLunchDinner;
            }
        }

        /// <summary>
        /// 是否含晚餐
        /// </summary>
        public bool HaveDinner
        {
            get
            {
                return MealType == MealType.Dinner || MealType == MealType.BreakfastDinner || MealType == MealType.LunchDinner || MealType == MealType.BreakfastLunchDinner;
            }
        }

        #endregion

        #region 价格

        /// <summary>
        /// 底价/卖价, 返回给分销商
        /// </summary>
        public Money Price { get; set; }

        /// <summary>
        /// 成本价格: 无佣金，用于计算[卖价抽佣]模式是否亏损
        /// </summary>
        public Money CostPrice { get; set; }

        /// <summary>
        /// 卖价/强制价格: 酒店规定的最低销售价
        /// </summary>
        public Money SellingPrice { get; set; }

        /// <summary>
        /// 每日价格
        /// </summary>
        public List<DailyPrice> DailyPrices { get; set; }

        #endregion

        #region 价格计划

        public string RatePlanId
        {
            get
            {
                return this.SupplierRate.RatePlanId;
            }
        }

        #endregion

        /// <summary>
        /// 免费取消时限，小时数 (分销渠道)
        /// <para>如果小时数为36，入住为10号，那么9号12点前可免费取消</para>
        /// <para>注意：各家供应商计算偏移量，酒店时区</para>
        /// </summary>
        public int FreeCancellationTimeLimit { get; set; }

        /// <summary>
        /// 供应商价格
        /// </summary>
        public SupplierRate SupplierRate { get; set; }
    }
}
